/*
 * acm1202.c
 *
 *  Created on: 27 Mar 2010
 *      Author: xuxu
 */

#include<stdio.h>
#include<stdlib.h>

int arrange(int n)
{
	int i,result;
	result=1;
	for(i=1;i<=n;i++)
		result*=i;
	return result;
}

int combin(int n,int c)
{
	int i,result;
	int t_n,t_c;
	t_n=n;
	t_c=c;
	result=1;
	for(i=0;i<c;i++,t_n--)
		result*=t_n;
	for(i=0;i<c;i++,t_c--)
		result/=t_c;
	return result;
}

int main()
{
	int num[13];
	int n,t,total;
	int i;
	int result_fenzi,result_fenmu;
	while(scanf("%d",&n)!=EOF)
	{
		memset(num,0,sizeof(num));
		total=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&t);
			total+=t;
			num[t]++;
		}
		result_fenzi=1;
		result_fenmu=1;
		for(i=1;i<=12;i++)
		{
			if(num[i]>1)
			{
				result_fenmu*=arrange(num[i]);
			}
		}
		for(i=1;i<=12;i++)
		{
			if(num[i])
			{
				result_fenzi*=combin(total,i);
				total-=i;
				num[i]--;
				i--;
			}
		}
		printf("%d\n",result_fenzi/result_fenmu);
	}
	return 0;
}
